package com.lsf.studentmanagerup.service;

import com.lsf.studentmanagerup.dao.UserDao;
import com.lsf.studentmanagerup.factory.UserDaoFactory;

import java.sql.SQLException;

/**
 * 管理员用户服务层
 *
 * @author 李树飞
 */
public class UserService {
    private UserDao userDao;

    public UserService() {
        this.userDao = UserDaoFactory.getUserDao();
    }

    public boolean userLoginService(String username, String password) {
        try {
            if (userDao.userLogin(username, password) != null) {
                System.out.println(UserService.class.getName() + "登录成功");
                return true;
            }else {
                System.out.println(UserService.class.getName() + "登录失败");
                return false;
            }
        } catch (SQLException e) {
            System.out.println("数据库连接异常");
            e.printStackTrace();
        }
        return false;
    }
}
